const http = require('http');
const cheerio = require('cheerio');
const https = require('https');

const server = http.createServer((req, res) => {
    
    https.get('https://www.askform.cn', (result) => {
        let data = '';
        result.on('data', (chunk) => {
            data += chunk;
        })
        result.on('end', () => {
            filterData(data);
        })
    })
    
}).listen('8080', () => {
    console.log('localhost:8080');
})

function filterData(data) {
    const $ = cheerio.load(data);
    $('.carousel-inner .item.active img').each(function (i, el) {
        console.log($(el).attr('src'));
    })
}